<?php !defined('DYHB_PATH') && exit; /* DoYouHaoBaby Framework 模板缓存文件 生成时间：2011-05-31 18:39:01  */ ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>DoYouHaoBaby示例：表单提交验证</title>
<link rel='stylesheet' type='text/css' href='__PUBLIC__/css/common.css'>
<script type="text/javascript" src="<?php echo __LIBCOM__;?>/Js/Vendor/Jquery.js"></script>
<script type="text/javascript" src="<?php echo __LIBCOM__;?>/Js/Dyhb.package.js"></script>
 </head>
 <body>
 
<script type="text/javascript">
 <!--
	function add(){

		Dyhb.AjaxSubmit('form1','__URL__/insert','result',complete);
	}

	function complete(data,status){

		if (status==1){

		// 更新列表
		$('#list').html( 
	    '<li style=\'font-weight:normal;background:#fc2745\'><div class="article_title">'+data.form_title+'</div>  <div class="article_detail">['+data.form_email+data.create_date+']</div><div class="content">'+data.form_content+'</div></li>'
	    +$('#list').html());
	    }
	}

	function checkTitle(){

		Dyhb.AjaxSend('__URL__/check_title','ajax=1&title='+$('#title').val(),'result');
	}

	function fleshSeccode(){

	//重载验证码
	var timenow = new Date().getTime();

	    document.getElementById('seccodeImg').src= '__URL__/seccode/'+timenow;
	}
 //-->
 </script>

 <div class="main">
 <h2>DoYouHaoBaby示例之：表单提交验证</h2>
<div class="title">本示例是表单提交验证处理，提交的时候增加了验证码？防止机器人添加数据</div>
<div id="result" class="none result" style="font-family:微软雅黑,Tahoma;letter-spacing:2px"></div>
<div class="line"></div>
   <form id="form1" method='post' action="__URL__/insert">
 <table cellpadding=2 cellspacing=2>
 <tr>
	<td class="tRight" width="12%">标题：</td>
	<td class="tLeft" ><input type="text" name="form_title" id="title" style="height:23px" class="large bLeft"> <input type="button" value="检 查" class="small button" onClick="checkTitle()"></td>
 </tr>
  <tr>
	<td class="tRight" >邮箱：</td>
	<td class="tLeft" ><input type="text" name="form_email" style="height:23px" class="huge bLeft"></td>
 </tr>
 <tr>
	<td class="tRight tTop" >内容：</td>
	<td><textarea name="form_content" class="huge bLeft" rows="8" cols="25"></textarea></td>
 </tr>
  <tr>
	<td class="tRight tTop" >验证码：</td>
	<td><input name="seccode" type="text" style="height:23px; width:60px;"  />&nbsp;<img id="seccodeImg" SRC="__URL__/seccode/" BORDER="0" ALT="" align="absmiddle">&nbsp;<a href="javascript:fleshSeccode()">刷新验证码</a></td>
 </tr>
 <tr>
	<td><input type="hidden" name="ajax" value="1"></td>
	<td><input type="button" onClick="add()" class="button" value="提 交"> <input type="reset" class="button" value="清 空"></td>
 </tr>
</table>
</form>

 <div class="line"></div>
<div class="article_list">
<div class="title">文章列表</div>
<ul id="list">
<?php $i=1 ;?>
<?php if( is_array( $arrObjectList ) ) : foreach( $arrObjectList as $key=>$value): ?>

  <li>
	<div class="article_title"><?php echo( $value->form_title ); ?></div><div class="article_detail">[<?php echo( $value->form_email ); ?> <?php echo( date( 'Y-m-d H:i:s',$value->create_date ) ); ?>]</div>
    <div class="content"><?php echo( $value->form_content ); ?></div>
  </li>

<?php $i++ ;?>
<?php endforeach;endif; ?>
</ul>
</div>

<div class="line"></div>
 <div class="title">示例源码</div><br/><div class="li_title">控制器IndexControl类</div><br/>
 <div class="code"><?php highlight_file( APP_LIB_PATH.'/Action/IndexController.class.php' ) ?></div><br/>
 <div class="li_title">模型FormModel类</div><br/>
 <div class="code"><?php highlight_file( APP_LIB_PATH.'/Model/FormModel.class.php' ) ?>
 </div>
</div>
 </body>
</html>